﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace zielonka.co.uk.extensions.system
{
	/*
		Description:	Checks if a given string contains any of the characters in the passed array of characters.
		
		char[] invalidFileNameCharacters = Path.GetInvalidFileNameChars();

		if (newFileName.ContainsAny(invalidFileNameCharacters))
		{
			MessageBox.Show("File name contains invalid characters.");
		}
	 */

	public static partial class StringExtensions
	{
		public static bool ContainsAny(this string theString, char[] characters)
		{
			foreach (char character in characters)
			{
				if (theString.Contains(character.ToString()))
				{
					return true;
				}
			}
			return false;
		}

				
	}
}
